package java_thinking.unit_14._14_7_Proxy.Excercise;

import java.lang.reflect.Proxy;

/**
 * @Desc:
 * @author: cww
 * @DateTime: 2020-02-26 9:54
 */

public class HelloServiceProxyTest {
    public static void main(String[] args) {
        HelloServiceProxyTest test = new HelloServiceProxyTest();
        test.proxy();
    }

    public void proxy() {
        HelloService service = new HelloServiceImpl();
        HelloService serviceProxy = (HelloService) Proxy.newProxyInstance(HelloServiceProxyTest.class.getClassLoader(),
                new Class[]{HelloService.class} ,
                new HelloServiceHandler(new HelloServiceImpl()));
        serviceProxy.sayHello("wwchen");
    }
}
